<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/template/principal.xhtml">
        <ui:define name="conteudo">
            <h:form id="form">
                <p:panel header="Atualizar Clientes">
                    <p:messages globalOnly="true"/>
                    <p:dataTable value="#{cliente.listaClientes}" var="c" rows="10" dynamic="false" paginator="true">
                        <p:column headerText="Nome" style="width: 30%"  filterBy="#{c.fkPessoa.nome}">
                            <p:commandLink action="#{cliente.editar}" ajax="false" >
                                <h:outputText value="#{c.fkPessoa.nome}"/>
                                <f:param name="cliente" value="#{c.idCliente}"/>
                            </p:commandLink>
                        </p:column>
                        <p:column headerText="CNPJ" style="width: 30%">
                            <h:outputText value="#{c.cnpj}"/>
                        </p:column>
                        <p:column headerText="Telefone" style="width: 20%">
                            <h:outputText value="#{c.fkPessoa.telefone1}"/>
                        </p:column>
                        <p:column headerText="Excluir" style="width: 20%">
                            <p:commandLink action="#{cliente.excluir}" ajax="false" >
                                <h:outputText value="Excluir"/>
                                <f:param name="idCliente" value="#{c.idCliente}"/>
                            </p:commandLink>    
                        </p:column>
                    </p:dataTable>
                </p:panel>
            </h:form>

        </ui:define>
    </ui:composition>
</html>